Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unify javascript content delivery networks; update frontend libraries to latest versions #59

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

shinenelson
Copy link

@shinenelson shinenelson commented Jun 5, 2020

currently there are 4 CDNs that are being called for different javascript libraries. this means that there are 4 different third-party requests being made on each load.

why do it?

the advantage of unifying all of the libraries from a single provider is that all of the requests can be served off a single connection if the connection is made over HTTP/2 essentially making the load times at least 2 times faster.

why jsDelivr?

jsDelivr has a wide network spanning multiple caching network providers whereas the other providers rely on a single caching network ( unpkg, cdnjs - cloudflare, github - fastly ). while technically all the requests could probably be served from the same backend cache, since the requests are being proxied via different domains, naturally, they have to go through different connections. if all the requests are proxied through the same
domain and via HTTP/2, the requests can all be served via the same connection making the page load faster.

other changes

- synced the library version for ace/ext-language_tools with the loaded ace.js library`

  • updated frontend libraries - ace and react to latest versions
  • vendored in corresponding scripts for-offline
  • removed an irrelevant check for non-macs in scripts/build/build-offline-dev.sh ( tested on ubuntu 20.04 LTS and debian 10 buster ).

### room for improvement
- react and babel-polyfill libraries could be upgraded to the latest major versions. since I wasn't sure whether this would cause any breakage in the application, I didn't attempt an upgrade. I just used the already existing version but just changed the provider URL. Maybe a minor version upgrade ( react ) would do much harm? ( I didn't want to take the risk since it was react )
I could however attempt to upgrade to the latest versions if given approval. I just don't know the application well enough to know where to look for breakages.

related : tddbin/katas#105

currently there are 4 CDNs that are being called for
different javascript libraries. this means that there are
4 different third-party requests being made on each load.
this changeset unifies the multiple CDNs into a single
provider - jsDelivr.net

why do it?
the advantage of unifying all of the libraries from a single
provider is that all of the requests can be served off a
single connection if the connection is made over HTTP/2
essentially making the load times at least 2 times faster.

why jsDelivr?
jsDelivr has a wide network spanning [multiple caching
network providers](https://www.jsdelivr.com/network) whereas
the other providers rely on a single caching network ( unpkg,
cdnjs - cloudflare, github - fastly ). while technically all
the requests could probably be served from the same backend
cache, since the requests are being proxied via different
domains, naturally, they have to go through different
connections. if all the requests are proxied through the same
domain and via HTTP/2, the requests can all be served via the
same connection making the page load faster.

other changes
- synced the library version for `ace/ext-language_tools`
with the loaded `ace.js` library

room for improvement
- `react` and `ace-builds` libraries could be upgraded to the
latest versions. since I wasn't sure whether this would cause
any breakage in the application, I didn't attempt an upgrade.
I just used the already existing version but just changed the
provider URL. Maybe a minor version upgrade ( react ) would
not do much harm? ( I didn't want to take the risk since it
was react )
also vendor ace-builds and babel-polyfill for offline-dev
@shinenelson shinenelson marked this pull request as draft June 5, 2020 16:18
note : though the required scripts are vendored in for
offline use, they don't really work. I tried different
versions from v1.2.2 to v1.4.11; none of them worked
offline; though all of them worked fine online. I couldn't
figure out how to fix the `Uncaught ReferenceError: ace is
not defined`

The last known good configuration to work is v1.1.9 which
is vendored in the repository, but unavailable in the ace-
builds package cache.
npm report : added 1 package, removed 11 packages, updated 2 packages
also : vendored in the script for offline-dev ( tested and validated )
works fine on ubuntu 20.04 LTS and debian 10 ( buster )
@shinenelson shinenelson changed the title unify javascript content delivery networks unify javascript content delivery networks; update frontend libraries to latest versions Jun 5, 2020
@shinenelson shinenelson marked this pull request as ready for review June 5, 2020 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant